﻿using System;
using Autodesk.Revit.DB;

namespace YJKExcelFormTool.Creator
{
	public class ViewSheetComparer
	{
		private static string GetViewSheetNumber(ViewSheet viewSheet)
		{
			Parameter parameter = viewSheet.get_Parameter(BuiltInParameter.SHEET_NUMBER);
			if (parameter == null)
			{
				throw new Exception("parameter 'SHEET_NUMBER' is null.");
			}
			return parameter.AsString();
		}

		public static int Compare(ViewSheet viewSheet1, ViewSheet viewSheet2)
		{
			string viewSheetNumber = ViewSheetComparer.GetViewSheetNumber(viewSheet1);
			string viewSheetNumber2 = ViewSheetComparer.GetViewSheetNumber(viewSheet2);
			return viewSheetNumber.CompareTo(viewSheetNumber2);
		}
	}
}
